{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Batch creation of Groups\n",
    "\n",
    "This sample notebook automates the task of creating groups in a Portal for ArcGIS or ArcGIS Online organization. A similar script can be used for creating or updating users and content.\n",
    "\n",
    "**Note**: To run this sample, you need the ``pandas`` library in your conda environment. If you don't have the library, install it by running the following command from cmd.exe or your shell\n",
    "```\n",
    "conda install pandas```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "toc": true
   },
   "source": [
    "<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
    "<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#Batch-creation-of-Groups\" data-toc-modified-id=\"Batch-creation-of-Groups-1\"><span class=\"toc-item-num\">1&nbsp;&nbsp;</span>Batch creation of Groups</a></span><ul class=\"toc-item\"><li><span><a href=\"#Data-preparation\" data-toc-modified-id=\"Data-preparation-1.1\"><span class=\"toc-item-num\">1.1&nbsp;&nbsp;</span>Data preparation</a></span></li></ul></li></ul></div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from arcgis.gis import GIS\n",
    "from IPython.display import display\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Data preparation\n",
    "\n",
    "In this sample, a list of groups to be created is read from a .csv file along with the properties and thumbnails to be used for creating the groups."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "groups_df = pd.read_csv('data/groups.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>access</th>\n",
       "      <th>description</th>\n",
       "      <th>isFav</th>\n",
       "      <th>isInvitationOnly</th>\n",
       "      <th>isViewOnly</th>\n",
       "      <th>phone</th>\n",
       "      <th>snippet</th>\n",
       "      <th>sortField</th>\n",
       "      <th>sortOrder</th>\n",
       "      <th>tags</th>\n",
       "      <th>thumbnail</th>\n",
       "      <th>title</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>public</td>\n",
       "      <td>This group includes a complete list of basemap...</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Standard basemaps for our organizations.</td>\n",
       "      <td>title</td>\n",
       "      <td>asc</td>\n",
       "      <td>Maps,Base,Basemap,Basemaps</td>\n",
       "      <td>data/Icons/Basemaps.png</td>\n",
       "      <td>Basemaps</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>org</td>\n",
       "      <td>This Group contains an inventory of map servic...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>The authoritative service catalog.</td>\n",
       "      <td>title</td>\n",
       "      <td>asc</td>\n",
       "      <td>Services,Maps,Data</td>\n",
       "      <td>data/Icons/CentralServices.png</td>\n",
       "      <td>Central Services</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>org</td>\n",
       "      <td>A group dealing with government and industry a...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Regulatory compliance tracking &amp; reporting.</td>\n",
       "      <td>modified</td>\n",
       "      <td>asc</td>\n",
       "      <td>Regulatory,Compliance</td>\n",
       "      <td>data/Icons/RegCompliance.png</td>\n",
       "      <td>Compliance</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   access                                        description  isFav  \\\n",
       "0  public  This group includes a complete list of basemap...  False   \n",
       "1     org  This Group contains an inventory of map servic...  False   \n",
       "2     org  A group dealing with government and industry a...  False   \n",
       "\n",
       "   isInvitationOnly  isViewOnly  phone  \\\n",
       "0              True        True    NaN   \n",
       "1             False       False    NaN   \n",
       "2             False       False    NaN   \n",
       "\n",
       "                                       snippet sortField sortOrder  \\\n",
       "0     Standard basemaps for our organizations.     title       asc   \n",
       "1        The authoritative service catalog.        title       asc   \n",
       "2  Regulatory compliance tracking & reporting.  modified       asc   \n",
       "\n",
       "                         tags                       thumbnail  \\\n",
       "0  Maps,Base,Basemap,Basemaps         data/Icons/Basemaps.png   \n",
       "1          Services,Maps,Data  data/Icons/CentralServices.png   \n",
       "2       Regulatory,Compliance    data/Icons/RegCompliance.png   \n",
       "\n",
       "              title  \n",
       "0          Basemaps  \n",
       "1  Central Services  \n",
       "2        Compliance  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "groups_df[:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "gis = GIS(\"https://pythonapi.playground.esri.com/portal\", \"arcgis_python\", \"amazing_arcgis_123\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Before we proceed, we will verify if these groups do not exist in our organization. If they exist, we will delete them so that we can re-create as part of the process that follows."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "for group_name in groups_df['title']:\n",
    "    g = gis.groups.search(query='title:'+group_name)\n",
    "    #if group exists with the title, delete it\n",
    "    if len(g)>0:\n",
    "        g[0].delete()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " The thumbnails are extracted from an Icons.zip file. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import zipfile\n",
    "with zipfile.ZipFile(\"data/Icons.zip\") as z:\n",
    "    z.extractall(\"data\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The code below reads the csv file line by line and creates groups in the portal using the specified parameters and thumbnails."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "import csv\n",
    "\n",
    "groups = []\n",
    "with open('data/groups.csv') as csvfile:\n",
    "    reader = csv.DictReader(csvfile)\n",
    "    for row in reader:\n",
    "        group = gis.groups.create_from_dict(row)\n",
    "        groups.append(group)   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To verify, we can display the newly created groups:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=da8d983e51134839bca3431b7cca9f45' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=da8d983e51134839bca3431b7cca9f45' target='_blank'><b>Basemaps</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Standard basemaps for our organizations.\n",
       "                        <br/><b>Description</b>: This group includes a complete list of basemaps for our organization. They provide relevant and consistent geographic context across all city departments; and are essential building blocks for the local government's desktop, mobile and web applications.  \n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Basemaps\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=ebc2c49173ad4de2be553357d908d2d9' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=ebc2c49173ad4de2be553357d908d2d9' target='_blank'><b>Central Services</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: The authoritative service catalog.   \n",
       "                        <br/><b>Description</b>: This Group contains an inventory of map services for our organization. These map services serve as building blocks for all maps and apps throughout the organization. \n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Central Services\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=bc5f07a5bf9d417a847c6d826c9b91c1' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=bc5f07a5bf9d417a847c6d826c9b91c1' target='_blank'><b>Compliance</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Regulatory compliance tracking & reporting.\n",
       "                        <br/><b>Description</b>: A group dealing with government and industry association regulatory compliance and reporting.\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Compliance\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=e7c07ff4d4e744129014cd018a36592c' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=e7c07ff4d4e744129014cd018a36592c' target='_blank'><b>Customer Service, Finance, Billing and Accounting</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: The Water & Sewer Billing and Collection Division manage the water and sewer accounts for residents.\n",
       "                        <br/><b>Description</b>: Typical types of users and roles that part of this group:Human Resources/PayrollAdministrative Services Officer I, IIAdministrative AideAccountantAccount ClerkPayroll ClerkDepartment AnalystRisk Management Analyst I,II,IIIAccounting TechnicianEngineering TechnicianCommon Task or Responsibilities of the users in this group:Customer ServiceReal Estate ServicesBudgets/Accounting/Long Range Financial PlanningSafety/Risk ManagementFinancingRecords Management/Clerical ServicesAuditingBill Collection and paymentConnections/DisconnectsReduced Rates / Leak AdjustmentsPool AdjustmentIrrigation and Hydrant MetersEmployee Development\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Customer Service, Finance, Billing and Accounting\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=fe541b5f283f4757af54b07f75b45d5f' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=fe541b5f283f4757af54b07f75b45d5f' target='_blank'><b>Demographic Content</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Esri demographic data with national coverage\n",
       "                        <br/><b>Description</b>: A catalog of Esri provided demographic content for use at the utility.\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Demographic Content\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=926b8429187a4e6b877ed095a99848d9' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=926b8429187a4e6b877ed095a99848d9' target='_blank'><b>Design and Engineering</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Design and Engineering is responsible for designing, planning and inspection construction and maintenance projects.\n",
       "                        <br/><b>Description</b>: Typical types of users and roles that part of this group:Chief EngineerAsst. Chief EngineerEngineeringEngineering TechInspectorElectricianLand SurveyorTechnical WriterCommon Task or Responsibilities of the users in this group:DesignConstructionEngineering/Survey ServicesPlanning\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Design and Engineering\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=031a635b930247ddaf9b0e8c4f9f9f5c' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=031a635b930247ddaf9b0e8c4f9f9f5c' target='_blank'><b>Disaster Response</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: A catalog of Esri Live Feeds which may be needed during a disaster\n",
       "                        <br/><b>Description</b>: A catalog of Esri Live Feeds which may be needed during a disaster.During disasters, the Esri Disaster Response Program receives numerous requests for access to live disaster data. In the United States and abroad, many data sources are already freely available from agencies, but not in a readily digestible or dynamic format* for Web GIS platforms. To unlock the potential of these data sets, we use the Aggregated Live Feed methodology.\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Disaster Response\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=c824e73635c2421ab5a1b50113b1192d' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=c824e73635c2421ab5a1b50113b1192d' target='_blank'><b>Executive Reports</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Maps, apps and reports for the Board or Executives.\n",
       "                        <br/><b>Description</b>: This group is used to catalog key performance indicators and content used by the Board or Executive of our organization.  \n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Executive Reports\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=d26bedceafd1444581d97f7ab2ee653d' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=d26bedceafd1444581d97f7ab2ee653d' target='_blank'><b>External Contractors</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Collection of maps and apps designed to coordinate with external contractors and engineering firms.\n",
       "                        <br/><b>Description</b>: Typical types of users and roles that part of thisEngineering ContractorsContracted OperationsCommon Task or Responsibilities of the external users.  Valve ExercisingHydrant FlushingDesignRehabilitationCCTV      \n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"External Contractors\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=643b4dd3859b4cf5b0a9508d0dfe5016' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=643b4dd3859b4cf5b0a9508d0dfe5016' target='_blank'><b>Featured Apps</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Apps that appear on the organization home page.\n",
       "                        <br/><b>Description</b>: This group contains a collection of applications highlighted on the organization's home page. \n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Featured Apps\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=4f828e4820b94beebf314c3918861490' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=4f828e4820b94beebf314c3918861490' target='_blank'><b>Field and Facility Maintenance</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Field Maintenance is responsible for the operations of the Water distribution system, Sewer Collection system and construction of those networks.\n",
       "                        <br/><b>Description</b>: Typical types of users and roles that part of this group:   Field Maintenance Manager   Asst. Field Maintenance Manager   Water/Sewer Utility I, II, III, IV   Heavy Equipment Operator   Meter Technicians/Mechanics   Building Superintendent I, II   Service Reader I,II   Warehouse ClerkCommon Task or Responsibilities of the users in this group.   Water Distribution   Valves &amp; Hydrants   Main Repair   Customer Service   Leak Investigation   Sewer Collection   Main Maintenance   Pump Operations &amp; Maintenance   TV/Video Inspection   Sewer Backup   Construction(Optional, may be under Engineering)   Main Install   Facility &amp; Grounds Maintenance   Grounds Maintenance   Regulatory Compliance   Meter Shop   Meter Reading   Inventory Control\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Field and Facility Maintenance\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=e06e277ace9d4a4c95d527cb62ea445a' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=e06e277ace9d4a4c95d527cb62ea445a' target='_blank'><b>Fire Service</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: A functional group designed to provide better coordination with the local fire departments\n",
       "                        <br/><b>Description</b>: Typical types of users and roles that part of this group:   Engineering Technician   GIS Technician   GIS Supervisor   Fire Department(External)  Common Task or Responsibilities of the users in this group:   Out of Service Hydrants   Fire Flow   Hydrant Inspections       \n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Fire Service\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=a64870a60116431bb037759190aa36de' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=a64870a60116431bb037759190aa36de' target='_blank'><b>Gallery</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Content in this group appears on the organization gallery.\n",
       "                        <br/><b>Description</b>:  This group contains a collection of maps, apps and mobile configurations highlighted in the organization's gallery.  \n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Gallery\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=b86e6f35c53a43ec801915f66409b50e' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=b86e6f35c53a43ec801915f66409b50e' target='_blank'><b>Industrial Monitoring</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: A group with maps to meet a State and Federal regulatory requirement to monitor what industries discharge into the sewer system.\n",
       "                        <br/><b>Description</b>: A group with maps to meet a State and Federal regulatory requirement to monitor what industries discharge into the sewer system. The Industrial Monitoring section issues permits to industries to limit the pollutants discharged into the sewer system, inspects the industries for compliance and takes action against industries that violate their permits.  Typical types of users and roles that part of this group:  Manager  Common Task or Responsibilities of the users in this group:  Industrial Waste Pretreatment ProgramIndustrial Permits and ComplianceViolationsSurveillanceEmergency Response\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Industrial Monitoring\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=173d7edf805d4a199e6faf1c67c65177' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=173d7edf805d4a199e6faf1c67c65177' target='_blank'><b>Lab Services</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Lab Services is responsible for testing drinking water and sampling waste water. This group includes the follow responsibility and roles at the utility.\n",
       "                        <br/><b>Description</b>: Lab Services functions as a support service for their environmental testing needs. The Lab also works with other government agencies to meet their testing needs. Lab Services can analyze drinking water, wastewater, surface water, groundwater, bio-solids, septage and solid samples for over 60 parameters.Typical types of users and roles that part of this group.   Manager  Common Task or Responsibilities of the users in this group.   Wastewater   FSE - FOG   Drinking Water   Trace Metals\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Lab Services\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=0a12f1f7ffe9423493b20c63efef965b' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=0a12f1f7ffe9423493b20c63efef965b' target='_blank'><b>Land Use Content</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Esri land use data with national coverage\n",
       "                        <br/><b>Description</b>: A catalog of Esri provided land use content with national coverage.\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Land Use Content\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=fb05be15916e40428cd3c8298c38638f' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=fb05be15916e40428cd3c8298c38638f' target='_blank'><b>Network Operations</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Provides the latest information on the operational status of the network, including outage information, trouble reports and latest crew locations.\n",
       "                        <br/><b>Description</b>: Content for the network operations group.\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Network Operations\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=46879e95890e460594241fa7d3143eaa' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=46879e95890e460594241fa7d3143eaa' target='_blank'><b>Public Maps and Apps</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Unsecured public facing content.   \n",
       "                        <br/><b>Description</b>: This group contains a collection of maps and apps available to customers or citizens in our organization.\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Public Maps and Apps\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=c6602082f6334ad3996b2cac865e59b7' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=c6602082f6334ad3996b2cac865e59b7' target='_blank'><b>Tools and Add-Ins</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Collection of extensions, tools and models.\n",
       "                        <br/><b>Description</b>:  This group contains a collection of add-ins, tools and models used by our organization.  \n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Tools and Add-Ins\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=a91d201eb62b4eeeb097fa35da29f421' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=a91d201eb62b4eeeb097fa35da29f421' target='_blank'><b>Wastewater Treatment</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: The Wastewater Treatment Division operates and maintains the treatment plant.   \n",
       "                        <br/><b>Description</b>: The Wastewater Treatment Division operates and maintains the treatment plant. The division protects the health of the community and environment by reclaiming wastewater from residential, commercial, and industrial sources.  Typical types of users and roles that part of this group:Superintendent of Water Pollution ControlWastewater Treatment Plant Operator I, II, I  Utility I, II  Common Task or Responsibilities of the users in this group:  Identify and define prohibited wastes;  Develop local limits on specific pollutants;  Obtain access to facilities for inspections and sampling;  Require non-residential dischargers to provide an adequate sampling location;  Require treatment of non-domestic wastes to meet discharge standards;  Require non-residential dischargers to obtain discharge permits;  Require non-residential dischargers to monitor their discharge and submit reports;  Take enforcement action for non-compliance with the program regulations.\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Wastewater Treatment\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=4c8eae3b0af34b66b327ade6a45322f5' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=4c8eae3b0af34b66b327ade6a45322f5' target='_blank'><b>Water Treatment</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: The Water Treatment Division operates and maintains treatment plants, elevated water storage tanks, reservoirs and pumping stations.\n",
       "                        <br/><b>Description</b>: The Water Treatment Division operates and maintains the treatment plant. The treatment process, which includes lime softening, dual media filtering, and chlorination and fluoridation, supplies a high quality, finished water that is unsurpassed in the region.  Typical types of users and roles that part of this group:  Superintendent of Water Pollution ControlWater Treatment Plant Operator I, II, IUtility I, II  Common Task or Responsibilities of the users in this group:  Boil Water NoticesConsumer Confidence ReportWater Treatment\n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Water Treatment\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=f134dc5421494d07af76bb7d945b1ca6' target='_blank'>\n",
       "                        <img src='' ' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://pythonapi.playground.esri.com/portal/home/group.html?id=f134dc5421494d07af76bb7d945b1ca6' target='_blank'><b>Web App Templates</b>\n",
       "                        </a>\n",
       "                        <br/>\n",
       "                        <br/><b>Summary</b>: Collection of web application templates.\n",
       "                        <br/><b>Description</b>: This group contains a collection of web application templates used in our organization. The application templates are used to exposed web maps as applications.  \n",
       "                        <br/><b>Owner</b>: arcgis_python\n",
       "                        <br/><b>Created</b>: January 01, 2023\n",
       "\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Group title:\"Web App Templates\" owner:arcgis_python>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for group in groups:\n",
    "    display(group)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.11"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": true,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
